import request from '@/utils/request'

export function getSiteMsg() {
  return request(
    {
      url: '/cloud/getSiteMsg',
      method: 'post'
    },
    { code_error_show: false }
  )
}

export function getTokenByLoginUser(account, password) {
  return request(
    {
      url: '/cloud/getTokenByLoginUser',
      method: 'post',
      data: { account, password }
    },
    { code_error_show: false }
  )
}

export function getSiteMsgByLoginUser(account, password) {
  return request(
    {
      url: '/cloud/getSiteMsgByLoginUser',
      method: 'post',
      data: { account, password }
    },
    { code_error_show: false }
  )
}

export function getUpdateMsg() {
  return request({
    url: '/cloud/getUpdateMsg',
    method: 'post'
  })
}

export function upgrade() {
  return request({
    url: '/cloud/upgrade',
    method: 'post',
    timeout: 10000000
  })
}

export function getAddon(name) {
  return request({
    url: '/cloud/addon',
    method: 'post',
    data: { name }
  })
}

export function downAddon(name) {
  return request({
    url: '/cloud/addon_down',
    method: 'post',
    timeout: 10000000,
    data: { name }
  })
}

export function getUpdateAddon(name) {
  return request({
    url: '/cloud/getUpdateAddon',
    method: 'post',
    data: { name }
  })
}
